<?php // no direct access
defined('_JEXEC') or die('Restricted access'); ?>
<?php /*?><ul class="latestnews<?php echo $params->get('moduleclass_sfx'); ?>">
<?php foreach ($list as $item) :  ?>
	<li class="latestnews<?php echo $params->get('moduleclass_sfx'); ?>">
		<a href="<?php echo $item->link; ?>" class="latestnews<?php echo $params->get('moduleclass_sfx'); ?>">
			<?php echo $item->text; ?></a>
	</li>
<?php endforeach; ?>
</ul><?php */?>

<style type="text/css">

.basictab{
padding: 3px 0;
margin-left: 0;
font: bold 12px Verdana;
border-bottom: 1px solid gray;
list-style-type: none;
text-align: left; /*set to left, center, or right to align the menu as desired*/
}

.basictab li{
display: inline;
margin: 0;
}

.basictab li a{
text-decoration: none;
padding: 3px 7px;
background-color: #CCC;
color: #2d2b2b;
}

/*.basictab li a:visited{
color: #DBFF6C;
}*/

.basictab li a:hover{
background-color: #346FAB;
color: #ffffff;
}

.basictab li a:active{
color: black;
}

.basictab li.selected a{ /*selected tab effect*/
position: relative;
top: 1px;
padding-top: 4px;
background-color: #346FAB;
color: #fff;
}
#booking_wrap{
	background-color:#DFDFDF;
	height:274px;
}
#booking_wrap select{
	padding:3px;	
}
#booking_main{
	padding:10px; 	
}
#booking_main hr{
	margin-top:10px;
}
</style>
<?php 
$tab = $_GET['tab'];
if($tab=='flights'){
	$packages 	= '';
	$flights 	= ' class="selected"';
	$hotels 	= '';
}
elseif($tab=='hotels'){
	$packages 	= '';
	$flights 	= '';
	$hotels	 	= ' class="selected"';
}
else{
	$packages 	= ' class="selected"';
	$flights	= '';
	$hotels 	= '';	
}
?>
<ul class="basictab">
<li<?php echo $packages;?>><a href="index.php?tab=packages">Packages</a></li>
<li<?php echo $flights;?>><a href="index.php?tab=flights">Flights</a></li>
<li<?php echo $hotels;?>><a href="index.php?tab=hotels">Hotels</a></li>
</ul>
<div id="booking_wrap">
	<div id="booking_main">
    <?php 		
		$db			=& JFactory::getDBO();
		$query	= "SELECT * FROM #__flight_destination where parent='0' order by id";
   		$db->setQuery($query);
		$select_destion	= $db->loadObjectList();
		$tab = $_GET['tab'];
		if($tab=='flights'){
			$page = '&tab='.$tab;
			$value = 'Flights';
		}
		else if($tab=='hotels'){
			$page = '&tab='.$tab;
			$value = 'Hotels';
		}
		else{
			$page = '';	
			$value = 'Packages';
		}
	?>
    <form name="frm_packages" method="post" action="index.php?option=com_packages<?php echo $page;?>">
    <?php if($tab=='hotels' || $tab=='flights'){?>
	<table border="0" cellpadding="0" cellspacing="0" width="100%">
    	<tr>
        	<td colspan="2" style="padding-bottom:15px;"><h3>Booking For Your Holiday</h3><hr /></td>
        </tr>
        <tr>
        	<td>
                <select name="original">
                	<option value="">Original</option>
                <?php for($i=0;$i<count($select_destion);$i++){?>
                	<option value="<?php echo $select_destion[$i]->id;?>">&nbsp;&nbsp<?php echo $select_destion[$i]->location_name;?></option>
                <?php }?>
                </select>
            </td>
        	<td><select name="adult">
                	<option value="">Adult</option>
                    <?php for($i=1;$i<=8;$i++){?>
                	<option value="<?php echo $i;?>">&nbsp;&nbsp;<?php echo $i;?></option>
                    <?php }?>
                </select>
            </td>
        </tr>
        <tr>
        	<td style="padding-top:10px;">
                <select name="destination">
                	<option value="">Destination</option>
                <?php for($i=0;$i<count($select_destion);$i++){?>
                	<option value="<?php echo $select_destion[$i]->id;?>">&nbsp;&nbsp;<?php echo $select_destion[$i]->location_name;?></option>
                <?php }?>
                </select>
            </td>
        	<td style="padding-top:10px;"><select name="child">
                	<option value="">Child</option>
                    <?php for($i=1;$i<=8;$i++){?>
                	<option value="<?php echo $i;?>">&nbsp;&nbsp;<?php echo $i;?></option>
                    <?php }?>
                </select>
            </td>
        </tr>
        <tr>
        	<td style="padding-top:10px;">
                <?php echo JHTML::calendar('Depart','depart','depart_id','%Y-%m-%d');?>
            </td>
        	<td style="padding-top:10px;">
	            <?php echo JHTML::calendar('Return','return','return_id','%Y-%m-%d');?>
            </td>
        </tr>
        <tr>
        	<td colspan="2" style="padding-top:10px;"><h3>Find a Package that suit you</h3><br/>Departure must be at least 4 days from current date.</td>
        </tr>
        <tr>
        	<td colspan="2" style="padding:10px 0 0 120px"><input type="submit" class="button_search" name="search_booking" value="Search <?php echo $value;?>" /></td>
        </tr>
    </table>
    <?php }
	else{?>
    <script type="text/javascript" src="http://kks.kounkhmerapp.com/javascript/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
	$('#wait_1').hide();
	$('#drop_1').change(function(){
	  $('#wait_1').show();
	  $('#result_1').hide();
      $.get("http://kks.kounkhmerapp.com/javascript/func.php", {
		func: "drop_1",
		drop_var: $('#drop_1').val()
      }, function(response){
        $('#result_1').fadeOut();
        setTimeout("finishAjax('result_1', '"+escape(response)+"')", 400);
      });
    	return false;
	});
});

function finishAjax(id, response) {
  $('#wait_1').hide();
  $('#'+id).html(unescape(response));
  $('#'+id).fadeIn();
}
</script>
	<table border="0" cellpadding="0" cellspacing="0" width="100%">
    	<tr>
        	<td colspan="2" style="padding-bottom:15px;"><h3>Booking Hotel For Your Holiday</h3><hr /></td>
        </tr>
        <tr>
        	<td colspan="2">Select Your Current Destination</td>
        </tr>
        <tr>
        	<td colspan="2" style="padding-top:10px;">
            	<select name="drop_1" id="drop_1">
                	<option value="" selected="selected">Select Type</option>
                	<option value="1">Inbound</option>
                	<option value="2">Outbound</option>
                </select>
            </td>
        </tr>
        <tr>
        	<td colspan="2" style="padding-top:5px;">
                <span id="wait_1" style="display: none;">
                <img alt="Please Wait" src="http://kks.kounkhmerapp.com/javascript/ajax-loader.gif"/>
                </span>
                <span id="result_1" style="display: none;"></span>
            </td>
        </tr>
        <tr>
        	<td colspan="2" style="padding-top:10px;"><h3>Find a Package that suit you</h3><br/>Booking must be at least 4 days from current date.</td>
        </tr>
        <tr>
        	<td colspan="2" style="padding:10px 0 0 120px"><input type="submit" class="button_search" name="search_booking" value="Search Itinerary" /></td>
        </tr>
    </table>
	<?php }?>
    </form>
    </div>
</div>